﻿@{
    Layout = "~/Views/Shared/_FormWhite.cshtml";
}
<div class="wrapper animated fadeInRight">
    <form id="form" class="form-horizontal m">
        <div class="form-group">
            <label class="col-sm-2 control-label ">审核结果<font class="red"> *</font></label>
            <div class="col-sm-10">
                <select id="auditStatus" col="auditStatus" class="form-control">
                    <option value="0">--请选择--</option>
                    <option value="1">审核通过</option>
                    <option value="9">驳回</option>
                </select>
            </div>
        </div>
        <div class="form-group" id="div_Remark" style="display:none;">
            <label class="col-sm-2 control-label ">审核说明<font class="red"> *</font></label>
            <div class="col-sm-10">
                <input id="auditReason" col="auditReason" type="text" class="form-control" />
            </div>
        </div>
        <div class="row" id="plateList" style="margin-top:20px;display:none;">
        </div>
    </form>
</div>
<style type="text/css">
    .plateBox {
        margin: 5px 25px;
        height: 40px;
        padding: 2px;
        border: 1px solid #288CE9;
    }

        .plateBox .plate {
            display: block;
            background-color: #288CE9;
            text-align: center;
            font-size: 24px;
            color: #fff;
            height: 34px;
            font-family: 宋体;
        }

        .plateBox .active {
            background-color: red;
        }
</style>
<script type="text/javascript">
    var id = ys.request("id");
    $(function () {
        $("#auditStatus").on('change', function () {
            var value = $(this).val();
            if (value == 1) {
                $("#div_Remark").hide();
                bindPlateList();
            } else if (value == 9) {
                $("#div_Remark").show();
            } else {
                alert("请选择审核结果");
            }
        });
    });
    function saveForm(index) {
        var data = {
            id:id,
            auditStatus: $("#auditStatus").val(),
            auditReason: $("#auditReason").val()
        };
        if (data.auditStatus==0) {
            ys.alertError('请选择审核结果');
            return;
        }
        if (data.auditStatus == 9 && data.auditReason == '') {
            ys.alertError('请输入审核原因');
            return;
        }
        
        ys.ajax({
            url: '@Url.Content("~/YiDongYuan/DetectionTask/UpdateTaskAudit")',
            type: 'post',
            data: data,
            success: function (obj) {
                if (obj.Tag == 1) {
                    ys.msgSuccess(obj.Message);
                    parent.searchGrid();
                    parent.layer.close(index);
                }
                else {
                    ys.msgError(obj.Message);
                }
            }
        });
    }
</script>